package com.android.pocketguru.Fragments;

import java.util.Calendar;

import com.android.pocketguru.AlarmHandler;
import com.android.pocketguru.Constants;
import com.android.pocketguru.R;

import android.os.Bundle;
import android.support.v4.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;



public class StartUpFragment extends Fragment{

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, 
        Bundle savedInstanceState) {

        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.main, container, false);
    }
    
    @Override
    public void onStart() {
        super.onStart();
        ((Button) getActivity().findViewById(R.id.btn_Set5SecAlarm)).setOnClickListener(new OnClickListener() { public void onClick(View v) { Settin5SecgAlarm(false); } });
        ((Button) getActivity().findViewById(R.id.btn_Set5SecAlarmDialog)).setOnClickListener(new OnClickListener() { public void onClick(View v) { Settin5SecgAlarm(true); } });

        ((Button) getActivity().findViewById(R.id.btn_SetRecurringAlarm)).setOnClickListener(new OnClickListener() { public void onClick(View v) { SetReacurringAlarm(false); } });
        ((Button) getActivity().findViewById(R.id.btn_SetRecurringDialogAlarm)).setOnClickListener(new OnClickListener() { public void onClick(View v) { SetReacurringAlarm(true); } });
}
    
    // TEST: Testing method. Will be removed
    public void Settin5SecgAlarm(boolean asDialog)
    {
		Calendar c = Calendar.getInstance(); 
		c.add(Calendar.SECOND, 5);
		
		long alarm_time = c.getTimeInMillis();
				
		AlarmHandler.setPopupAlarm(getActivity().getBaseContext(), alarm_time, Constants.ALARM_TEST_REQUEST_CODE, false, asDialog);
    }
    
    // TEST: Testing method. Will be removed
    public void SetReacurringAlarm(boolean asDialog)
    {
    	AlarmHandler.setRecurringAlarm(getActivity().getBaseContext(), Constants.ALARM_TEST_REQUEST_CODE, asDialog);
    }
}
